<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2018/3/24
 * Time: 22:50
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CardSeries extends Model
{
    public $timestamps=true;
    protected $table='card_series';
    
    public function cards()
    {
        return $this->hasMany(Cards::class);
    }
    
    public function logs()
    {
        return $this->hasMany(UserDrawLotsLog::class);
    }
    
    public function awards()
    {
        return $this->hasMany(Award::class);
    }
    
    
    public function getImgAttribute()
    {
        if(!$this->attributes['img'])return '';
        return starts_with($this->attributes['img'],'http') ? $this->attributes['img'] : config('filesystems.disks.admin.url').$this->attributes['img'];
    }
    public function getFirstImgAttribute()
    {
        if(!$this->attributes['first_img'])return '';
        return starts_with($this->attributes['first_img'],'http') ? $this->attributes['first_img'] : config('filesystems.disks.admin.url').$this->attributes['first_img'];
    }
}